import { NullEngine, Scene, SceneLoader } from '@babylonjs/core'

const server = async () => {
  const engine = new NullEngine()
  const scene = new Scene(engine)

  const init = () => {
    return new  Promise((resovle) => {
      SceneLoader.Append('assets/', 'living-room-blender.glb', scene, () => {
        resovle()
      })
    })
  }
  
  await init()

  return {
    useCamera: (name: string) => {
      const camera = scene.getNodeByName(name)
      return camera 
    }
  }
}

export default server
